package com.thinkit.bigdata.web.thread;

import com.thinkit.bigdata.web.dao.bus.BusWktVoiceMapper;
import com.thinkit.bigdata.web.model.bus.BusWktVoice;
import org.apache.log4j.Logger;

import java.util.List;

/**
 * 异步添加录音流水号
 *
 */
public class WorkTestThread extends Thread {

    private static Logger logger = Logger.getLogger(WorkTestThread.class);

    private Long workId;
    private BusWktVoiceMapper busWktVoiceMapper;
    private List<String> serialNumberList;

    public WorkTestThread(Long workId, BusWktVoiceMapper busWktVoiceMapper, List<String> serialNumberList) {
        this.workId = workId;
        this.busWktVoiceMapper = busWktVoiceMapper;
        this.serialNumberList = serialNumberList;
    }

    @Override
    public void run() {
        logger.info("【模型测检子线程】开始执行");
        for (String serialNumber : serialNumberList) {
            BusWktVoice busWktVoice = new BusWktVoice();
            busWktVoice.setTestworkid(workId);
            busWktVoice.setSerialnumber(serialNumber);
            busWktVoiceMapper.insertSelective(busWktVoice);
        }
    }
}
